#include "StdAfx.h"
#include "ComboExUI.h"

CComboExUI::CComboExUI(void)
{
}

CComboExUI::~CComboExUI(void)
{
}

LPCTSTR CComboExUI::GetClass() const
{
	return _T("ComboEx");
}

void CComboExUI::SetAttribute( LPCTSTR pstrName, LPCTSTR pstrValue )
{
	if(_tcscmp(pstrName, _T("arrownormalimage")) == 0)
		m_sArrowNormalImage = pstrValue;
	else if (_tcscmp(pstrName, _T("leftnormalimage")) == 0)
		m_sLeftNormalImage = pstrValue;
	else if (_tcscmp(pstrName, _T("centernormalimage")) == 0)
		m_sCenterNormalImage = pstrValue;
	else if (_tcscmp(pstrName, _T("rightnormalimage")) == 0)
		m_sRightNormalImage = pstrValue;
	else
		CComboUI::SetAttribute(pstrName, pstrValue);
}

void CComboExUI::PaintStatusImage( HDC hDC )
{
	if( IsFocused() ) m_uButtonState |= UISTATE_FOCUSED;
	else m_uButtonState &= ~ UISTATE_FOCUSED;
	if( !IsEnabled() ) m_uButtonState |= UISTATE_DISABLED;
	else m_uButtonState &= ~ UISTATE_DISABLED;

	if( (m_uButtonState & UISTATE_DISABLED) != 0 ) {
		if( !m_sDisabledImage.IsEmpty() ) {
			if( !DrawImage(hDC, (LPCTSTR)m_sDisabledImage) ) m_sDisabledImage.Empty();
			else return;
		}
	}
	else if( (m_uButtonState & UISTATE_PUSHED) != 0 ) {
		if( !m_sPushedImage.IsEmpty() ) {
			if( !DrawImage(hDC, (LPCTSTR)m_sPushedImage) ) m_sPushedImage.Empty();
			else return;
		}
	}
	else if( (m_uButtonState & UISTATE_HOT) != 0 ) {
		if( !m_sHotImage.IsEmpty() ) {
			if( !DrawImage(hDC, (LPCTSTR)m_sHotImage) ) m_sHotImage.Empty();
			else return;
		}
	}
	else if( (m_uButtonState & UISTATE_FOCUSED) != 0 ) {
		if( !m_sFocusedImage.IsEmpty() ) {
			if( !DrawImage(hDC, (LPCTSTR)m_sFocusedImage) ) m_sFocusedImage.Empty();
			else return;
		}
	}

	if( !m_sLeftNormalImage.IsEmpty() ) {
		if( !DrawImage(hDC, (LPCTSTR)m_sLeftNormalImage) ) m_sLeftNormalImage.Empty();

	}

	if( !m_sCenterNormalImage.IsEmpty() ) {
		if( !DrawImage(hDC, (LPCTSTR)m_sCenterNormalImage) ) m_sCenterNormalImage.Empty();

	}

	if( !m_sRightNormalImage.IsEmpty() ) {
		if( !DrawImage(hDC, (LPCTSTR)m_sRightNormalImage) ) m_sRightNormalImage.Empty();

	}

	if( !m_sArrowNormalImage.IsEmpty() ) {
		if( !DrawImage(hDC, (LPCTSTR)m_sArrowNormalImage) ) m_sArrowNormalImage.Empty();

	}
}
